package com.hexiang.domain.vo;

import com.hexiang.validator.CreateBookGroup;
import com.hexiang.validator.DeleteBookGroup;
import com.hexiang.validator.UpdateBookGroup;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 书籍请求对象
 */
@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class BookRequestVO implements Serializable {

    @NotNull(message = "请选择书籍", groups = {UpdateBookGroup.class, DeleteBookGroup.class})
    private Long id;

    @NotEmpty(message = "书籍名称不能为空", groups = CreateBookGroup.class)
    private String name;

    @NotEmpty(message = "书籍作者不能为空")
    private String author;

    @NotNull(message = "书籍价格不能为空")
    @DecimalMin("1.00")
    private BigDecimal price;

}
